package com.ocom.webapi.controller;

import com.ocom.common.constant.HumanServiceUrl;
import com.ocom.common.resp.Result;
import com.ocom.webapi.service.VisitorRecordService;

import com.ocom.webapi.vo.visitorrecord.OnShowVo;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

//@Slf4j
@RestController
@PreAuthorize("@pms.hasRole('ROLE_WEB')" )
public class VisitorRecordContoller {
    private final Logger log = LoggerFactory.getLogger(VisitorRecordContoller.class);

    @Autowired
    private VisitorRecordService visitorRecordService;

    /**
     * 审批记录列表（VisitorRecord/onShow）
     * */
    @PostMapping(HumanServiceUrl.URL_VisitorRecordOnShow)
    public Result VisitorRecordOnShow(@Validated @RequestBody OnShowVo onShowVo){
        log.info("审批记录列表请求参数:{{}}",onShowVo);
        return visitorRecordService.VisitorRecordOnShow(onShowVo);
    }


    /**
     * 添加访客申请（VisitorRecord/add）
     * */
    @PostMapping(HumanServiceUrl.URL_VisitorRecordAdd)
    public Result VisitorRecordAdd(@Validated @RequestBody OnShowVo onShowVo){
        log.info("添加访客申请请求参数:{{}}",onShowVo);
        return visitorRecordService.VisitorRecordOnShow(onShowVo);
    }
}
